Objective C Insanity -- simple assignement to a single float variable results in {{{CRAZY}}} values
Posted
by morgancodes
on Stack Overflow
See other posts from Stack Overflow
or by morgancodes
Published on 2010-03-16T22:35:11Z
Indexed on
2010/03/16
22:41 UTC
Read the original article
Hit count: 372
objective-c
|madness
memberA is defined in the header of ClassA.
memberB is defined in the header of ClassB.
ClassB is a subclass of ClassA
Inside an instance of ClassB, setting memberA via simple assignment:
memberA = 0.05
...also changes memberB, but to a crazy number -- 1028443341. Additionally, assigning 0.05 to memberA results in memberA showing up in the debugger as 5.33083531e-38.
Both variables are floats, neither is a pointer. I'm almost certianly making some noob mistake, but I don't have any clue what it might be. What sort of screw-up might make it so assigning a value to one variable results in crazy values appearing in two variables?
I can give more details or real code, but figured I'd keep it simple to start with in case it's an obvious problem/solution.
© Stack Overflow or respective owner